<template>
  <div class="toast">
    <i :class="type=='success'?'el-icon-success':
    (type=='warning'?'el-icon-warning':
    'el-icon-error')" class= "iconfont"></i>
    <span>{{ msg }}</span>
  </div>
</template>


<script>
import { mapState } from "vuex";
export default {
  data() {
    return {};
  },
  computed: {
    ...mapState({
      msg: state => state.toastStatus.msg,
      type: state => state.toastStatus.type,
    }),
  },
};
</script>

<style lang="less" scoped>
.toast {
  position: fixed;
  left: 50%;
  top: 0;
  transform: translate(-50%);
  background-color: white;
  padding: 10px 20px;
  border-radius: 5px;
  box-shadow: 0 0 10px white;
  i {
    margin-right: 5px;
  }
}
.el-icon-error{
  color: red;
}
.el-icon-success{
  color:green;
}
.el-icon-warning {
  color: orange;
}
</style>